Table of contents
Preamble
When using a HamGeek (Pluto) SDR with an Ethernet cable plugged directly into your computer with no DHCP server functionality, you will quickly discover that the SDR doesn’t configure a default IP. This forces you to SSH into the SDR using the debug JTAG USB port every time you restart it to configure it using ifconfig. As an additional thorn in the side, the rootfs is not persistent between reboots - it is loaded from a read-only blob on the SD card on every boot.
This guide will help you automatically configure the Ethernet IP by adjusting the rootfs blob to include statements to set the IPv4 address to a custom value.
Extracting the rootfs
The rootfs is inside a gzip-compressed initramfs with a U-Boot header, we first remove said header to get to the initramfs
mkdir work && cd work
dd if=/path/to/uramdisk.image.gz of=initramfs.gz bs=64 skip=1
You can verify it extracted properly:
file initramfs.gz
It should say gzip compressed data.
You can now create a rootfs directory and extract the contents of the initramfs image there:
mkdir rootfs && cd rootfs
sudo sh -c "gunzip -c ../initramfs.gz | cpio -idmv"
We now have access to the rootfs which can be modified as you wish.
Adjusting the IP
To have the IP configure itself to the default from the official instructions, edit the following file:
./etc/init.d/S40network:L27
- ETH_IPADDR=`fw_printenv -n ipaddr_eth 2> /dev/null | tr -cd '[a-zA-Z0-9]._-'`
- ETH_NETMASK=`fw_printenv -n netmask_eth 2> /dev/null || echo 255.255.255.0 | tr -cd '[a-zA-Z0-9]._-'`
- ETH_GW=`fw_printenv -n gateway_eth 2> /dev/null | tr -cd '[a-zA-Z0-9]._-'`
+ ETH_IPADDR=`fw_printenv -n ipaddr_eth 2> /dev/null || echo 192.168.1.10 | tr -cd '[a-zA-Z0-9]._-'`
+ ETH_NETMASK=`fw_printenv -n netmask_eth 2> /dev/null || echo 255.255.255.0 | tr -cd '[a-zA-Z0-9]._-'`
+ ETH_GW=`fw_printenv -n gateway_eth 2> /dev/null || echo 192.168.1.1 | tr -cd '[a-zA-Z0-9]._-'`
This sets the gateway to 192.168.1.1 and SDR IP to 192.168.1.10 as per the official instructions. You can replace these with custom values if you wish so.
Repack rootfs
Now that we changed the network config, we can repack the rootfs. Run this from inside the rootfs directory:
sudo sh -c "find . | cpio -o -H newc | gzip -9" > ../initramfs.gz
cd ..
Now that the initramfs is packed, we can add the U-Boot header back:
mkimage -A arm -O linux -T ramdisk -C gzip -n "PlutoSDR ramdisk" -d initramfs.gz ./uramdisk.image.gz
The new image is now in the current directory as uramdisk.image.gz. You can copy it over to the SD card, replacing the old one
You’re done! Upon restart, the SDR should automatically configure with the IP 192.168.1.10 and 192.168.1.1 as the gateway on the Ethernet interface.
Note: When connecting directly to the SDR, you should configure your computer’s Ethernet interface to use 192.168.1.99 for the address and 192.168.1.1 for the gateway, as per the official HamGeek guide.